import type { ApplicationContent } from "@/core/application/application-content"
import type { ApplicationTopBarMenu } from "@/core/application/application-top-bar-menu"
import type { ApplicationDockMenu } from "@/core/application/application-dock-menu"
import type { ApplicationHook } from "@/core/application/application-hook"

export interface ApplicationInfo {
  readonly id: string
  readonly name: string
  readonly icon: string
  readonly content: ApplicationContent
  readonly topBarMenu: ApplicationTopBarMenu
  readonly dockMenu: ApplicationDockMenu
  inDock: boolean
  inMainPanel: boolean
  readonly hook?: ApplicationHook
}

export function toState(info: ApplicationInfo) {
  const obj: any = {}
  obj.inDock = info.inDock
  obj.inMainPanel = info.inMainPanel
  return obj
}

export function fromState(obj: any, info: ApplicationInfo) {
  if (obj.inDock) {
    info.inDock = obj.inDock
  }
  if (obj.inMainPanel) {
    info.inMainPanel = obj.inMainPanel
  }
}
